﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class 宋宋 : Form
    {
        public 宋宋()
        {
            InitializeComponent();
        }

        public static Dictionary<string, string> _user = new Dictionary<string, string>();

        private void Form1_Load(object sender, EventArgs e)
        {
            _user.Add("admin", "123456");
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {

            var uid = User.Text;
            var pwd = Pasd.Text;

            var reg = _user.Where(x => x.Key == uid).FirstOrDefault();

            if (reg.Key == uid && reg.Value == pwd)
            {
                MessageBox.Show("登陆成功", "恭喜你",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
            }
            else 
            {
                MessageBox.Show("登陆失败","很遗憾",MessageBoxButtons.YesNo,MessageBoxIcon.Warning);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            RegisterForm registerForm = new RegisterForm();
            registerForm.Show();
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void 宋宋_MouseClick(object sender, MouseEventArgs e)
        {
            List<Color> list = new List<Color>();
            list.Add(Color.AliceBlue);
            list.Add(Color.Pink);
            list.Add(Color.SeaGreen);
            list.Add(Color.BlueViolet);
            list.Add(Color.Yellow);
            list.AddRange(new Color[]
                {
                    Color.AliceBlue,Color.Pink,Color.SeaGreen,Color.BlueViolet,Color.Yellow
            });
            Random random = new Random();
            var rndInt = random.Next(0, 5);

            var rndColor = list[rndInt];

            BackColor = rndColor;
        }
    }
}
